@extends('user.layouts.master')
@section('content')
    edu.topic.manager.blade.php
    <div class="card">
        <div class="card-header">
            <div>
                贴子列表
                <a href="{{route('edu.topic.create')}}" class="btn btn-light btn-sm float-right">发表</a>
            </div>
        </div>
        <div class="card-body">
            <ul class="list-group list-group-lg list-group-flush list my--4">
                @foreach($topics as $topic)
                    <li class="list-group-item px-0">
                        <div class="row align-items-center">
                            <div class="col ml--2">
                                <h4 class="card-title mb-1 name">
                                    <a href="{{route('edu.topic.show',$topic)}}">
                                        {{$topic['title']}}
                                    </a>
                                </h4>
                                <p class="card-text small text-muted mb-1">
                                    {{$topic->category->name}}
                                </p>
                                <p class="card-text small text-muted">
                                    {{$topic->user->name}}
                                    <span class="fe fe-clock mr-1"></span> {{$topic->updated_at->diffForHumans()}}
                                </p>
                            </div>
                            <div class="col-auto">
                                <a href="{{route('edu.topic.edit',$topic)}}"
                                   class="btn btn-sm btn-white d-none d-md-inline-block">
                                    编辑
                                </a>
                                <a href="javascript:;" onclick="confirm('确定删除吗')?$(this).next().submit():''"
                                   class="btn btn-sm btn-white d-none d-md-inline-block">
                                    删除
                                </a>
                                <form action="{{route('edu.topic.destroy',$topic)}}" method="post">
                                    @csrf @method('DELETE')
                                </form>
                            </div>
                        </div>

                    </li>

                @endforeach

            </ul>
        </div>
        <div class="card-footer text-muted">
            {{$topics->links()}}
        </div>
    </div>
@endsection
